import axios from "axios";

// 获取列表
export function getlist(params) {
  return axios({
    url: "http://localhost:3001/data",
    method: "GET",
    params,
  });
}

// 新增
export function addlist(data) {
  return axios({
    url: "http://localhost:3001/data",
    method: "POST",
    data,
  });
}

// 数据回显
export function coplist(id) {
  return axios({
    url: `http://localhost:3001/data/${id}`,
    method: "GET",
  });
}
// 编辑修改
export function sublist(data) {
  return axios({
    url: `http://localhost:3001/data/${data.id}`,
    method: "PUT",
    data,
  });
}

// 删除
export function dellist(id) {
  return axios({
    url: `http://localhost:3001/data/${id}`,
    method: "DELETE",
  });
}

// 搜索
export function searchlist(neme) {
  return axios({
    url: `http://localhost:3001/data/?name=${neme}`,
    method: "GET",
  });
}
